
import 'package:FineArt/constants.dart';
import 'package:FineArt/utils/size_config.dart';
import 'package:flutter/material.dart';

class TextTagWidget extends StatefulWidget {
  final Color color;
  final Color bgColor;
  final String text;
  final Function textClick;
  final double fontSize;
  final bool selected;
  final int index;
  TextTagWidget({this.bgColor: bg_input, this.color: Colors
      .blue, this.text, this.textClick,this.fontSize,this.index = 0,this.selected = false});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _TextTagWidget();
  }
}
  class _TextTagWidget extends State<TextTagWidget> {
  @override
  Widget build(BuildContext context) {
    double fontSize = widget.fontSize;
    if(fontSize==0){
      fontSize = setSp(15);
    }
    return InkWell(
      onTap:(){
        widget.textClick(widget.text,widget.index);
      },
      child: Container(
        //height: getPortraitSHeight(34),
        padding: EdgeInsets.symmetric(horizontal: getPortraitSWidth(9),vertical: getPortraitSHeight(6)),
        decoration: BoxDecoration(
            color:widget.selected?widget.bgColor:category_bg_unselected,
            // border: Border.all(color: color, width: 1),
            borderRadius: BorderRadius.all(Radius.circular(radius(17)))),
        constraints: BoxConstraints(minWidth:getPortraitSWidth(81) ),
        child: Text(
          widget.text,
          textAlign: TextAlign.center,
          style: TextStyle(fontSize: fontSize, color: widget.color,height: 1.5),
        ),
      ),
    );
  }


}
